package com.huaguoguo.spring.context;

import com.huaguoguo.spring.annotation.Autowired;

import java.lang.reflect.Field;
import java.util.Map;

public class AutowiredHandler {

    /**
     * 处理组件中需要注入的属性
     * @param beanMap
     * @param beanInstance
     */
    public void autowiredField(Map<String, Object> beanMap, Object beanInstance){
        Field[] fields = beanInstance.getClass().getDeclaredFields();
        for (Field field : fields) {
            Autowired autowired = field.getAnnotation(Autowired.class);
            if (autowired != null) {
                Object fieldValue = beanMap.get(field.getName());

            }
        }
    }
}
